<style type="text/css">
	.editImg +form tr td input[type='text']{
		border: none!important;
	}
</style>

<form action="" class="top30 infoW">
    <table class="tableNew tableRaius" for="" border="0" cellspacing="0" cellpadding="0" style="border-collapse:separate;border-spacing: 0;">
        <tr>
            <td>抵押物类型</td>
            <td >
                <?php
                    $paramsType = \Yii::$app->params['mortgageTypes3'];
                    $typeStr = '';
                    if (!empty($mortgageInfoTable['mortgage_type'])){
                        $typeArr = explode(',',$mortgageInfoTable['mortgage_type']);
                        if (!empty($typeArr)&&is_array($typeArr)){
                            foreach ($typeArr as $k=>$v) {
                                $typeStr=$typeStr.$paramsType[$v]['name'].',';
                            }
                        }
                    }
                    if (!empty($typeStr)){
                        $typeStr = rtrim($typeStr,',');
                    }
                ?>
                <input style="" type="text" readonly="readonly" name="" id="" title="抵押物类型" value="<?= $typeStr;?>" />
            </td>
            <td>权属人</td>
            <td>
                <input style="" type="text" readonly="readonly" name="" id="" title="权属人" value="<?= !empty($mortgageInfoTable['mortgage_owner'])?$mortgageInfoTable['mortgage_owner']:'';?>" />
            </td>
        </tr>
        <tr>
            <td>抵押物编号/他项权证号</td>
            <td>
                <input  type="text" readonly="readonly" name="" id="" title="抵押物编号/他项权证号" value="<?= !empty($mortgageInfoTable['mortgage_code'])?$mortgageInfoTable['mortgage_code']:'';?>" />
            </td>
            <td>所在区域</td>
            <td>
                <input  type="text" readonly="readonly" name="" id="" title="所在区域" value="<?= !empty($mortgageInfoTable['mortgage_district'])?$mortgageInfoTable['mortgage_district']:'';?>" />
            </td>
        </tr>
        <tr>
            <td>抵押物地址</td>
            <td colspan="3">
            	<pre><?= !empty($mortgageInfoTable['mortgage_address'])?$mortgageInfoTable['mortgage_address']:'';?></pre>
               <!-- <input  type="text" readonly="readonly" name="" id="" title="抵押物地址" value="<?= !empty($mortgageInfoTable['mortgage_address'])?$mortgageInfoTable['mortgage_address']:'';?>" />-->
            </td>
        </tr>
        <tr>
            <td> 建筑面积（㎡）</td>
            <td>
                <input  type="text" readonly="readonly" name="" id="" title="建筑面积（㎡）" value="<?= !empty($mortgageInfoTable['mortgage_building_area'])?$mortgageInfoTable['mortgage_building_area']:'';?>" />
            </td>
            <td>土地面积（㎡）</td>
            <td>
                <input  type="text" readonly="readonly" name="" id="" title="土地面积（㎡）" value="<?= !empty($mortgageInfoTable['mortgage_land_area'])?$mortgageInfoTable['mortgage_land_area']:'';?>" />
            </td>
        </tr>
        <tr>
            <td>最高抵押额度（元）</td>
            <td>
                <input  type="text" readonly="readonly" name="" id="" title="最高抵押额度（元）" value="<?= !empty($mortgageInfoTable['maximum_mortgage'])?$mortgageInfoTable['maximum_mortgage']:'';?>" />
            </td>
            <td>剩余使用年限</td>
            <td>
                <input style="color: #333333;" type="text" readonly="readonly" name="" id="" title="剩余使用年限" value="<?= !empty($mortgageInfoTable['remaining_service_life'])?$mortgageInfoTable['remaining_service_life']:'';?>" />
            </td>
        </tr>
    </table>
</form>

<form action="" id="diYaWuXinXi" style="display: none;" class="infoEdit borderColor">
    <table class="tableNew tableRaius editTable tableEdit4 top30" for="" border="0" cellspacing="0" cellpadding="0" style="border-collapse:separate;border-spacing: 0; border: none!important;">
        <input type="text" hidden value="<?= !empty($ppseid)?$ppseid:0;?>" id="ppseid1">
        <input type="text" hidden value="<?= !empty($mortgageInfoTable['id'])?$mortgageInfoTable['id']:'';?>" id="mortgage_id">
        <tr>
            <td>抵押物类型</td>
            <td class="type">
            	
                <select type='select' name="" aria-invalid="<?= !empty($mortgageInfoTable['mortgage_type'])?$mortgageInfoTable['mortgage_type']:'';?>" class="select mortgage_type" id="fromselect1" multiple="multiple">
            </td>
            <td>权属人</td>
            <td>
                <input type="text" name=""  id="mortgage_owner" value="<?= !empty($mortgageInfoTable['mortgage_owner'])?$mortgageInfoTable['mortgage_owner']:'';?>" />
            </td>
        </tr>
        <tr>
            <td>他项权证号</td>
            <td>
                <input type="text" name=""  id="mortgage_code" value="<?= !empty($mortgageInfoTable['mortgage_code'])?$mortgageInfoTable['mortgage_code']:'';?>" />
            </td>
            <td>所在区域</td>
            <td>
                <input type="text" name="" id="mortgage_district" value="<?= !empty($mortgageInfoTable['mortgage_district'])?$mortgageInfoTable['mortgage_district']:'';?>" />
            </td>
        </tr>
        <tr>
            <td>抵押物地址</td>
            <td colspan="3">
            	
                <textarea name="" rows="" cols="" class="textarea-edit" id="mortgage_address" style="padding: 0 10px!important;"><?= !empty($mortgageInfoTable['mortgage_address'])?$mortgageInfoTable['mortgage_address']:'';?></textarea>
            </td>
        </tr>
        <tr>
            <td> 建筑面积（㎡）</td>
            <td class="yz">
                <input type="text" name="" id="mortgage_building_area" value="<?= !empty($mortgageInfoTable['mortgage_building_area'])?$mortgageInfoTable['mortgage_building_area']:'';?>" />
            </td>
            <td>土地面积（㎡）</td>
            <td class="yz">
                <input type="text" name="" id="mortgage_land_area" value="<?= !empty($mortgageInfoTable['mortgage_land_area'])?$mortgageInfoTable['mortgage_land_area']:'';?>"/>
            </td>
        </tr>
        <tr>
            <td>最高抵押额度（元）</td>
            <td class="yz">
                <input type="text" name="" id="maximum_mortgage" value="<?= !empty($mortgageInfoTable['maximum_mortgage'])?$mortgageInfoTable['maximum_mortgage']:'';?>" />
            </td>
            <td>剩余使用年限</td>
            <td class="yz">
                <input type="text" name="" id="remaining_service_life" value="<?= !empty($mortgageInfoTable['remaining_service_life'])?$mortgageInfoTable['remaining_service_life']:'';?>"/>
            </td>
        </tr>
    </table>
    <div class="cancelInConfirm clearfix">
        <input id="ajaxMortgageInfo" class="cancelInConfirmActive" type="button" value="保存" />
        <input id='cancelInfo' type="button" value="取消" />
    </div>
</form>
<script>
    $(function () {
    	 //高亮显示开始
         $(document).on("focus",'textarea',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(document).on("blur",'textarea',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		
		 $(".borderColor").on("focus",'input',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'input',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
		 $(".borderColor").on("focus",'select',function(){
				$(this).css({
							'border':'1px solid #2194f1'
				})
			})
		$(".borderColor").on("blur",'select',function(){
			$(this).css({
						'border':'1px solid #e2e2e2'
			})
		})
    	//高亮显示结束
        var mortgage_id = $("#mortgage_id").val();
        var data = [{id: 1, text: '房产'}, {id: 2, text: '土地'}, {id: 3, text: '林矿'}, {id: 4, text: '交通运输'}, {id: 5, text: '机械设备'}, {id: 6, text: '股权'}, {id: 7, text: '无形资产'}, {id: 8, text: '其他资产'}];
        var dataID = '<?= $mortgageInfoTable["mortgage_type"]; ?>'.split(',');
        $("#fromselect1").select2({data:data}).val(dataID).trigger('change');
        $("#ajaxMortgageInfo").click(function () {
            var mortgage_type = $("#fromselect1").val();
            var mortgage_owner = $("#mortgage_owner").val();
            var mortgage_code = $("#mortgage_code").val();
            var mortgage_district = $("#mortgage_district").val();
            var mortgage_address = $("#mortgage_address").val();
            var mortgage_building_area = $("#mortgage_building_area").val();
            var mortgage_land_area = $("#mortgage_land_area").val();
            var maximum_mortgage = $("#maximum_mortgage").val();
            var remaining_service_life = $("#remaining_service_life").val();
            var ppseid1 = $("#ppseid1").val();
            var url = '/project/ajax-save-mortgage-info-table-project';
            var Pdtat = {
                'mortgage_type':mortgage_type,
                'mortgage_owner':mortgage_owner,
                'mortgage_code':mortgage_code,
                'mortgage_district':mortgage_district,
                'mortgage_address':mortgage_address,
                'mortgage_building_area':mortgage_building_area,
                'mortgage_land_area':mortgage_land_area,
                'maximum_mortgage':maximum_mortgage,
                'remaining_service_life':remaining_service_life,
                'mortgage_id':mortgage_id,
                'ppseid':ppseid1,
            };
            $.post(url,{data:Pdtat,mortgage_id:mortgage_id},function (res) {
                if(res){
                    layer.msg('保存成功')
                    infoW();
                    location.reload();
                }else{
                    layer.msg('保存失败')
                }
            })
        })
        //-----------------渲染无编辑页面--------------------
        function infoW() {
            var ppseid1 = $("#ppseid1").val();
            $.get('/project/get-mortgage-view-table',{'project_id':project_id,'postion':1,'mortgage_id':mortgage_id,"ppseid":ppseid1},function (res) {
                $(".infoEdit").remove();
                $(".infoW").remove();
                $("#info1").before(res);
                $("#getInfo1").show();
            })
        }
        //-----取消保存按钮
        $("#cancelInfo").click(function () {
            var ppseid1 = $("#ppseid1").val();
            $.post('/project/ajax-un-lock',{'postion':111,'ppesid':ppseid1,},function (res) {
                var JSONData = JSON.parse(res)
                if (JSONData.code == 200){
                    layer.msg(JSONData.message);
                }else{
                    layer.msg(JSONData.message);
                }
            });
            $(".infoEdit").hide();
            $(".infoW").show();
        })
    })
    
</script>